package com.itheima.consumer.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.HeadersExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class RabbitHeaderConfig {

//    @Bean
//    public Queue queue6() {
//        return new Queue("queue6", true); // 'true' for durable queue
//    }
//
//    @Bean
//    public Queue queue7() {
//        return new Queue("queue7", true);
//    }
//
//    @Bean
//    public HeadersExchange headersExchange() {
//        return new HeadersExchange("headersExchange");
//    }
//
//    @Bean
//    public Binding binding1(Queue queue6, HeadersExchange headersExchange) {
//        Map<String, Object> headers = new HashMap<>();
//        headers.put("type", "info");
//        headers.put("format", "json");
//        return BindingBuilder.bind(queue6).to(headersExchange).whereAll(headers).match();
//    }
//
//    @Bean
//    public Binding binding2(Queue queue7, HeadersExchange headersExchange) {
//        Map<String, Object> headers = new HashMap<>();
//        headers.put("type", "error");
//        return BindingBuilder.bind(queue7).to(headersExchange).whereAny(headers).match();
//    }

}
